<template>
    <view>
        <!-- gc_school/pages/shop/my.wxml -->
        <cu-custom class="bgmains" bgColor="bgmains" :isBack="true">
            <view slot="content">我的小店</view>
        </cu-custom>
		<!-- style="filter: blur(4rpx);" :style="[{ backgroundImage:'url(' +data.info.business_image + ')' }]" -->
		<view>
			<image style="filter: blur(12rpx);height: 700rpx;position: relative;width: 100%;" :src="data.info.business_image" mode="aspectFill"></image>
			<view class="main" >
				<image
					class="avatar"
					:src="data.info.business_image"
					mode="scaleToFill"
				/>
				<view @click="go('/gc_school/pages/shop/info')" class="name margin-top margin-bottom-xs">{{data.info.business_name}}
					<image class="margin-left-sm" :src="fileUrl+'store/edit.png'" style="width: 30rpx;height: 30rpx;"></image>
				</view>
				<view class="zi">所属学院：{{data.school_name?data.school_name:'学校不存在' }}</view>
				<!-- <view class="zi">到期时间：{{data.expire_time}}</view> -->
				<view class="price_info padding">
					<view class="row">
						<view @click="go('/gc_school/pages/shop/balancelog')">
							<view class="key">我的余额（元）</view>
							<view class="val margin-top-xs">{{data.store_balance}}</view>
						</view>
						<view class="tx_btn" @click="go('/gc_school/pages/shop/tixian')">提现</view>
					</view>
					<view class="tj row margin-top-lg">
						<view class="flex-col" @click="go('/gc_school/pages/shop/order')">
							<view class="key">今日订单</view>
							<view class="val">{{data.order_day_num||0}}</view>
						</view>
						 <view class="flex-col" @click="go('/gc_school/pages/shop/order')">
							<view class="key">总订单</view>
							<view class="val">{{data.order_num||0}}</view>
						</view>
						 <view class="flex-col padding-right" @click="go('/gc_school/pages/shop/beanlog')" v-if="data.store_bean_switch==1">
							<view class="key">金豆</view>
							<view class="val">{{data.info.balance}}</view>
							<!-- <view class="text-lg text-red">（提现受限）</view> -->
						</view>
					</view>
				</view>
			</view>
		</view>

        <!-- <view class="title text-center text-lg">欢迎您，老潼关肉夹馍</view> -->
        <view class="tit padding-left margin-top">常用功能</view>
        <view class="nav_list padding" :style="show==true?'padding-bottom: 300rpx;':''">
            <block v-for="(item,index) in navList" :key="index">
            
            <view class="nav row padding" @click="go(item.url)"
            v-if="(index==0&&data.store_bean_switch==1)||index>0"
            >
                <image
                    class="icon"
                    :src="item.icon"
                    mode="scaleToFill"
                />
                {{item.name}}
                <view class="cuIcon-right"></view>
            </view>
            </block>

        </view>

       
       

        <view class="menu" v-if="1==2">
            <view class="menu_item" @tap="jump" data-url="/gc_school/pages/shop/recharge">
            <!-- <view class="menu_item" @tap="jump" data-url="/gc_school/pages/shop/pointrecharge"> -->
                <image src="/static/images/store/recharge.png"></image>
                <view>金豆充值</view>
            </view>
            <view class="menu_item" @tap="jump" data-url="/gc_school/pages/shop/info">
                <image src="/static/images/store/store.png"></image>
                <view>店铺管理</view>
            </view>
            <view class="menu_item" @tap="jump" data-url="/gc_school/pages/shop/order">
                <image src="/static/images/store/order.png"></image>
                <view>订单列表</view>
            </view>
            <view class="menu_item" @tap="jump" data-url="/gc_school/pages/shop/cate">
                <image src="/static/images/store/cate.png"></image>
                <view>分类管理</view>
            </view>
            <view class="menu_item" @tap="jump" data-url="/gc_school/pages/shop/goods">
                <image src="/static/images/store/goods.png"></image>
                <view>商品管理</view>
            </view>
        </view>
		
		<view class="notice_fixed padding-sm" v-if="show&&data.store_bean_switch==1">
			<image class="bg" mode="widthFix" :src="fileUrl+'store/notice_bg.png'"></image>
			<view class="padding notice_con">
				<view class="flex align-center" style="width: 100%;">
					<image class="icon" :src="fileUrl+'store/icon6.png'"></image>
					<view class="text-lg titles text-bold">您的店铺金豆{{data.info.balance>0?'即将':'已'}}用完</view>
					<text class="cuIcon-close" @click="show=false"></text>
				</view>
				<view class="text-df margin-top-sm">{{data.info.balance>0?'即将影响您店铺接单收益，请尽快充值哦～':'店铺接单和商家提现会受到影响，请尽快充值哦～'}}</view>
				<view class="flex justify-end margin-top-sm">
					<view class="recharge_btn close_btn" @click="show=false">关闭</view>
					<view class="recharge_btn" @click="go('/gc_school/pages/shop/pointrecharge')">立即充值</view>
				</view>
			</view>
			
		</view>
		
      </view>
</template>

<script>
// gc_school/pages/shop/my.js
var app = getApp();
export default {
    data() {
        return {
            data: {
                today_count: 0,
                total_count: 0,
                total_sum: 0,
                school: '',
                store: {
                    deadtime: ''
                }
            },
            id: '',
            navList:[
                {icon: 'https://www.xiaoaojianghu.top/wximage/store/icon1.png',name:"金豆充值",url:"/gc_school/pages/shop/pointrecharge"},
                // {icon: 'https://www.xiaoaojianghu.top/wximage/store/icon2.png',name:"店铺管理",url:"/gc_school/pages/shop/info"},
                {icon: 'https://www.xiaoaojianghu.top/wximage/store/icon3.png',name:"订单管理",url:"/gc_school/pages/shop/order"},
                {icon: 'https://www.xiaoaojianghu.top/wximage/store/icon4.png',name:"分类管理",url:"/gc_school/pages/shop/cate"},
                {icon: 'https://www.xiaoaojianghu.top/wximage/store/icon5.png',name:"商品管理",url:"/gc_school/pages/shop/goods"}
            ],
			show:false
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {
        console.log(options);
        if (options.id) {
            this.setData({
                id: options.id
            });
        }

        
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
		this.getStore();
	},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    // onShareAppMessage: function () {
    // }
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */ 
	methods: {
        getStore() {
            var that = this;
            app.globalData.util.request({
                url: 'ZhBusiness/index',
				method: 'GET',
                data: {
                    id: this.id
                },
                success(res) {
					console.log(res.data.data.is_inform)
					// show
					that.show = res.data.data.is_inform==1?true:false
                //    res.data.data.store_bean_switch=0
                    that.setData({
                        data: res.data.data
                    });
                }
            },true);
        },

        jump(e) {
            console.log(e.currentTarget.dataset.url);

            if (e.currentTarget.dataset.url) {
                uni.navigateTo({
                    url: e.currentTarget.dataset.url
                });
            }
        }
    }
};
</script>
<style lang="scss">
/* gc_school/pages/shop/my.wxss */
page {
    background: white !important;
}
.bgmains{
	color: white;
}
.title {
    background: white;
    margin-top: -10rpx;
    line-height: 120rpx;
    margin-bottom: 30rpx;
}

.list {
    margin-top: -15rpx;
    background: white;
    display: flex;
    margin-bottom: 30rpx;
    padding: 40rpx 0 20rpx;
    text-align: center;
    font-size: 30rpx;
    line-height: 60rpx;
}
.list_item {
    width: 50%;
    border-right: 1rpx solid #f2f2f2;
    /* border: 1rpx solid #F2F2F2; */
}
.list_item .num {
    font-weight: bold;
    font-size: 36rpx;
}

.menu {
    display: flex;
    flex-wrap: wrap;
    background: white;
}
.menu_item {
    text-align: center;
    font-size: 30rpx;
    width: 50%;
    border-right: 1rpx solid #f2f2f2;
    border-bottom: 1rpx solid #f2f2f2;
    padding: 50rpx 0;
}
.menu_item image {
    width: 95rpx;
    height: 95rpx;
    margin-bottom: 20rpx;
}
.notice_fixed{
	position: fixed;
	bottom: 0;
	width: 100%;
	.bg{
		width: 100%;
		border-radius: 20rpx;
	}
	.notice_con{
		position: absolute;
		top: 30rpx;
		left: 30rpx;
		width: 92%;
	}
	.icon{
		width: 50rpx;
		height: 50rpx;
		margin-right: 10rpx;
	}
	.cuIcon-close{
		font-size: 40rpx;
		font-weight: bold;
	}
	.titles{
		flex-grow: 1;
	}
	.close_btn{
		border: 2rpx solid #FF4C4D;
		background-color: white !important;
		color: #FF4C4D !important;
		margin-right: 20rpx;
	}
	.recharge_btn{
		background-color: #FF4C4D;
		width: 160rpx;
		height: 60rpx;
		line-height: 60rpx;
		border-radius: 50rpx;
		color: white;
		text-align: center;
		font-size: 24rpx;
	}
}
</style>
<style lang="scss">
    @import  "./my.scss";
</style>

